package com.czx.util;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class JvmCacheUtil {
    private static Map<String, String> map = new ConcurrentHashMap<>();

    public static <T> T get(String key, Class<T> t) {
        String s = map.get(key);
        return JSONObject.parseObject(s, t);
    }

    public static void put(String key, Object o) {
        map.put(key, JSON.toJSONString(o));
    }
}
